import './assets/main.css'
import './assets/framework/font-awesome/css/font-awesome.min.css';
import { createApp } from 'vue'
import App from './App.vue'
import router from './router'
import axios from 'axios'
import 'swiper/css';
import ElementPlus from 'element-plus'
import 'element-plus/dist/index.css'

const app = createApp(App)

app.use(ElementPlus)
app.use(router)
app.use(axios)
app.mount('#app')

    // 使用路由守卫实现登录的权限验证
router.beforeEach(function (to, from, next) {
    let users = sessionStorage.getItem('user');
    //除了登录、注册之外，都需要判断是否登录
    if (!(to.path == '/' || to.path == '' || to.path == '/register'||to.path == '/forgotPassword')) {
        if (users == null) {
            router.push('/');
        }
    }
    next();
});
createApp(App).use(router).mount('#app')